'use strict';

module.exports = app => {
  const { router, controller: { appointment }, middleware: { validator, checkPageTable, checkParams } } = app;

  const baseUrl = '/api/appointment';
  router.get(baseUrl + '/my', checkPageTable(), appointment.indexMy);
  router.get(baseUrl + '/myReview', checkPageTable(), appointment.indexMyReview);
  router.patch(baseUrl + '/agree', validator('common.checkId'), appointment.agree);
  router.patch(baseUrl + '/disagree', validator('common.checkId'), appointment.disagree);
  router.get(baseUrl + '/statisticalAppointment', appointment.statisticalAppointment);
  router.get(baseUrl + '/statisticalAppointmentAll', appointment.statisticalAppointmentAll);
  router.get(baseUrl + '/statisticalAppointmentAdd', appointment.statisticalAppointmentAdd);
  router.get(baseUrl, checkPageTable(), appointment.index);
  router.get(baseUrl + '/:id', checkParams(), appointment.show);
  router.post(baseUrl, validator('appointment.create'), appointment.create);
  router.put(baseUrl + '/:id', checkParams(), validator('appointment.update'), appointment.update);
  router.delete(baseUrl + '/:id', checkParams(), appointment.destroy);
};
